<!--<script type="text/javascript" src="/assets/js/custom/map.js"></script>-->
<style>
    .radioBtn .pitchOn {
        background-image: url(/assets/images/unchecked.png);
    }

    .radioBtn .unchecked {
        background-image: url(/assets/images/selected.png);
    }
</style>
<div class="col-12" id="mapWidth">
    <div class="profile-user-info">
        <div class="deviceState">
            <p style="display: inline-block">
                <span class="stateGreen mr2"></span><span class="mr6">正常</span>
                <span class="stateRed mr2"></span><span class="mr6">上限、下限</span>
                <span class="stateOrange mr2"></span><span class="mr6">超时</span>
                <span class="stateBrown mr2"></span><span class="mr6">无数据</span>
                <span class="stateBlue-grey mr2"></span><span class="mr6">异常</span>
            </p>
        </div>
        <div id="locationMap">
            <div id="allmap"></div>
        </div>

        <div style="position: absolute;right: 40px;top: 34px; z-index:1;">
            <ul class="tool-container">
                <li><a><i class="fa fa-warning"></i>告警</a></li>
                <li><a style="border-right: 1px solid #e4eaec;border-left: 1px solid #e4eaec"><i class="fa fa-line-chart"></i>历史数据</a></li>
                <li><a style="border-right: 1px solid #e4eaec;"><i class="fa fa-cog"></i>控制</a></li>
                <li><a><i class="fa fa-edit"></i>设备</a></li>
            </ul>
            <div class="searchBtn"><i class="fa fa-search"></i></div>
        </div>

        <ul class="popupBox">
            <li class="warningPopup" style="width:482px;">
                <div class="title">
                    <button type="button" class="close" data-dismiss="modal" aria-label="关闭">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h5>告警</h5>
                </div>
                <div class="warnPopupHeight" style="height: 400px;">
                    <div class="bjui-pageContent" style="top: 40px;">
                        <table class="table table-bordered" id="alarmTable">
                        </table>
                    </div>
                </div>
            </li>
            <li class="lineChartPopup">
                <div class="title">
                    <button type="button" class="close" data-dismiss="modal" aria-label="关闭">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h5>历史数据</h5>
                </div>
                <div class="lineChartPopupHeight" style="max-height: 500px;">
                    <div id="setTime" class="bjui-row col-1 pt10" style="text-align:center;display: none; margin-top:20px;">
                        <div class="input-group ml-6">
                            <div style="display: inline-block;">
                            <span class="input-group-addon" style="width: 40px;float:left;line-height: 22px">
                                <i class="fa fa-calendar" aria-hidden="true"></i>
                            </span>
                                <input style="width: 180px" type="text" id="from" name="datetime" style="height: 30px">
                            </div>
                        </div>
                        <div class="input-group ml-6">
                            <div style="padding-top: 10px;display: inline-block;">
                                <span class="input-group-addon" style="width: 40px;float:left;line-height: 22px">至</span>
                                <input style="width: 180px; height: 30px" type="text" id="to" name="datetime">
                            </div>
                        </div>
                        <div class="input-group pt10">
                            <button type="button" class="btn-blue1 btn" id="btnreturnback" onclick="return saveTime()"
                                    data-icon="save">确定
                            </button>
                        </div>
                    </div>
                    <div id="echart" align="center"></div>
                </div>

            </li>
            <li class="setUpPopup">
                <div class="title">
                    <button type="button" class="close" data-dismiss="modal" aria-label="关闭">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h5>控制</h5>
                </div>
                <div class="bjui-row col-1 setUpPopupHeight" style="width: 420px;">
                        <div class="bs-callout bs-callout-info">
                            <h4 style="letter-spacing: 0.8px">上报周期大于或者等于采样周期,水位上限大于水位下限</h4>
                        </div>
                    <form action="http://b-jui.com/demo/save?callback=?" class="datagrid-edit-form"
                          data-toggle="validate" data-data-type="jsonp">
                        <label class="row-label">上报周期：</label>
                        <div class="row-input">
                            <input id="locationReportCycle" class="w-bfz80" type="text"
                                   placeholder="输入周期" data-rule="number" autocomplete="off">
                            <span class="c76838f">分钟</span>
                        </div>
                        <label class="row-label">采样周期：</label>
                        <div class="row-input">
                            <input id="locationSampleCycle" class="w-bfz80" type="text"
                                   placeholder="输入周期" data-rule="number" autocomplete="off">
                            <span class="c76838f">分钟</span>
                        </div>
                        <label class="row-label">水位上限：</label>
                        <div class="row-input">
                            <input id="controlUpperLimit" type="text" class="w-bfz80"  placeholder="输入水位上限" data-rule="number" autocomplete="off">
                            <span class="c76838f">米</span>
                        </div>
                        <label class="row-label">水位下限：</label>
                        <div class="row-input">
                            <input id="controlLowerLimit" type="text"  class="w-bfz80"  placeholder="输入水位下限" data-rule="number" autocomplete="off">
                            <span class="c76838f">米</span>
                        </div>
                        <label class="row-label">所有设备：</label>
                        <div class="row-input">
                            <div class="radioBtn pr20">
                                <div class="pitchOn"></div>
                                <span>是</span>
                            </div>
                            <div class="radioBtn">
                                <div class="unchecked" checked="checked"></div>
                                <span>否</span>
                            </div>
                        </div>
                    </form>

                    <div class="row-input ml-bfz30 pt4">
                        <button class="btn-blue1 btn" data-icon="save" onclick="controlSaveInfo()">发送
                        </button>
                        <p style="display:inline-block;"><button type="button" class="btn-green1 btn" onclick="historicalAllocation()">历史配置</button></p>
                        <p style="display:inline-block;"><button type="button" class="btn-orange1 btn" id="ipConfigurationBtn" onclick="ipConfiguration();">IP配置</button></p>
                    </div>
                </div>

            </li>
            <li class="editPopup">
                <div class="title">
                    <button type="button" class="close" data-dismiss="modal" aria-label="关闭">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h5>设备</h5>
                </div>
                <div class="content editPopupHeight">
                    <div class="bjui-row col-1 pt20" style="width: 380px;">
                        <label class="row-label">设备名称：</label>
                        <div class="row-input required">
                            <input id="locationName" type="text" data-rule="required" placeholder="设备名称" autocomplete="off">
                        </div>
                        <label class="row-label">Sn：</label>
                        <div class="row-input">
                            <input id="locationSn" type="text" placeholder="Sn">
                        </div>
                        <label class="row-label">Imei：</label>
                        <div class="row-input">
                            <input id="locationImei" type="text" placeholder="Imei" autocomplete="off">
                        </div>
                        <label class="row-label">Imsi：</label>
                        <div class="row-input">
                            <input id="locationImsi" type="text" placeholder="Imsi" autocomplete="off">
                        </div>
                        <label class="row-label">设备位置：</label>
                        <div class="row-input">
                            <input id="location" type="text" placeholder="经纬度" autocomplete="off">
                            <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
                        </div>
                        <label class="row-label">设备型号：</label>
                        <div class="row-input">
                            <input id="locationModel" type="text" placeholder="型号" autocomplete="off">
                        </div>
                        <label class="row-label">所属用户</label>
                        <div class="row-input">
                            <select data-toggle="selectpicker" id="locationOwner"  data-width="192">
                                <option value="">请选择</option>
                            </select>
                        </div>
                        <label class="row-label">上报周期：</label>
                        <div class="row-input ">
                            <input id="locationReport" class="w-bfz80" type="text" placeholder="周期">
                            <span class="c76838f">分钟</span>
                        </div>
                        <label class="row-label">采样周期：</label>
                        <div class="row-input">
                            <input id="locationSample" class="w-bfz80" type="text" placeholder="周期">
                            <span class="c76838f">分钟</span>
                        </div>
                        <label class="row-label">水位上限：</label>
                        <div class="row-input">
                            <input id="locationUpperLimit" class="w-bfz80" type="text" placeholder="水位上限">
                            <span class="c76838f">米</span>
                        </div>
                        <label class="row-label">水位下限：</label>
                        <div class="row-input">
                            <input id="locationLowerLimit" class="w-bfz80" type="text" placeholder="水位下限">
                            <span class="c76838f">米</span>

                        </div>
                        <label class="row-label">设备信息：</label>
                        <div class="row-input">
                            <textarea id="locationDeviceInfo" style="height: 100px;" placeholder="备注"></textarea>
                        </div>
                        <div class="row-input ml-bfz34 pt4">
                            <button onclick="return EditInfo()" id="btnEdit" type="button"
                                    class="btn-green1 btn"
                                    data-icon="edit">编辑
                            </button>
                            <button onclick="return SaveInfo()" id="btnSave" type="button"
                                    class="btn-blue1 btn"
                                    data-icon="save">保存
                            </button>
                        </div>
                    </div>

                </div>

            </li>
            <li class="searchPopup">
                <div class="title">
                    <button type="button" class="close" data-dismiss="modal" aria-label="关闭">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h5>搜索</h5>
                </div>
                <div class="bjui-row col-1 pt20" style="width: 420px;">
                    <label class="row-label">设备名称：</label>
                    <div class="row-input">
                        <input id="searchDeviceName" class="w-bfz86" type="text" placeholder="输入设备名称" autocomplete="off">
                    </div>
                    <label class="row-label">设备信息：</label>
                    <div class="row-input">
                        <input id="searchDeviceInfo" class="w-bfz86" type="text" placeholder="输入设备信息" autocomplete="off">
                    </div>
                    <label class="row-label">所属用户</label>
                    <div class="row-input">
                        <select data-toggle="selectpicker" id="searchDeviceOwner"  data-width="192">
                            <option value="">请选择</option>
                        </select>
                    </div>
                    <label class="row-label"></label>
                    <div class="row-input pt4">
                        <button type="button" class="btn-blue1 btn" data-icon="search" onclick="searchDevice()">搜索
                        </button>
                        <button type="button" class="btn-green1 btn ml20" data-icon="search" onclick="resetDevice()">重置
                        </button>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
<script type="text/javascript" src="/assets/js/custom/map.js"></script>

<script type="text/javascript">
    var centerLng=${centerLng};
    var centerLat=${centerLat};
    $(function () {
        //百度地图
        map = new BMap.Map("allmap");
        map.addControl(new BMap.NavigationControl());
        map.enableScrollWheelZoom();
        map.centerAndZoom(new BMap.Point(${centerLng},${centerLat}), 12);

        changePopupHeigth($(".warnPopupHeight"), 0.5);
        changePopupHeigth($(".lineChartPopupHeight"), 0.6);
        changePopupHeigth($(".setUpPopupHeight"), 0.52);
        changePopupHeigth($(".editPopupHeight"), 0.6);
    })
    function ipConfiguration() {
        BJUI.dialog({
            id:'ipconfiguration',
            url:'/sysmanage/devicemonitor/ipconfiguration.do',
            title:'配置IP'
        })
    }
    $(function () {
        var loginRoleid=${LoginUserKey.roleId};
        var userid=${adminRoleId};
        if(loginRoleid==userid){
            $("#ipConfigurationBtn").css("display");

        }else{
            $("#ipConfigurationBtn").css("display","none");
        }
    })
</script>





















